import org.junit.Test;

import java.util.Iterator;
import java.util.TreeSet;

/**
 * @description:TreeSet的使用
 * @author:Mr.Cat
 * @create:2021-10-28 09:01
 **/
public class TreeSetTest {

    @Test
    public void test1(){
        TreeSet set = new TreeSet();

        //不能添加不同类的对象
        //set.add(123);
        //set.add("AA");

        //
        set.add(23);
        set.add(5);
        set.add(120);
        Iterator iterator = set.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
    @Test
    public void test2(){
        Comparable com = new Comparable() {
            @Override
            public int compareTo(Object o) {
                return 0;
            }
        };

        TreeSet set = new TreeSet();

    }
}

